package com.yesido.moshi.moshi23.single.lanhan;

import com.yesido.moshi.moshi23.single.ehan.SingleTon2;

/**
 * @author yesido
 * @description 线程不安全 对第四种synchronized的优化
 * @date 2023-06-12 12:07
 * @Version 8.3
 */
public class SingleTon5 {
    private SingleTon5 (){

    }
    private static SingleTon5 instance;

    /**
     * 线程不安全
     * @return
     */
    public static SingleTon5 getInstance(){
        if (instance==null){
            synchronized (SingleTon5.class){
                instance = new SingleTon5();
            }
        }
        return instance;
    }
}
